/**
 * Created by arnold.zhu on 7/4/2017.
 */
import React from 'react';

import {Router, Route, IndexRoute, hashHistory} from 'react-router';

import RootComponent from './root.js';

import LoginComponent from './login/login.js';

import MainComponent from './layout/main.js';

import HomeComponent from './home/home.js';
import RoleListComponent from './user/role/role.js';
import RoleEditComponent from './user/role/role-edit.js';

import UserListComponent from './user/user/user.js';

import NoMatchComponent from './404.js';

const Routes = () => (
  <Router history={hashHistory}>
    <Route path="/" component={RootComponent}>
      <IndexRoute component={LoginComponent}/>
      <Route path="/main" component={MainComponent}>
        <Route path="/main/home" component={HomeComponent}/>
        <Route path="/main/role/list" component={RoleListComponent}/>
        <Route path="/main/role/edit/:id" component={RoleEditComponent}/>
        <Route path="/main/user/list" component={UserListComponent}/>
      </Route>
      <Route path="*" component={NoMatchComponent}/>
    </Route>
  </Router>
);

export default Routes;